package com.chilly.designpattern.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

/**
 * Created by Chilly Cui on 2020/11/18.
 */
@Component
public class DemoPublisher {

    @Autowired
    ApplicationContext applicationContext;

    public void publish(String message) {
        //发布事件
        applicationContext.publishEvent(new DemoEvent(this, message));
    }
}
